export function get(url, params) {
	uni.showLoading()
	return new Promise((resolve, reject) => {
		uni.request({
			url: url,
			method: 'GET',
			data: params,
			success: res => {
				uni.hideLoading()
				resolve(res.data)
			},
			fail: err => {
				uni.hideLoading()
				uni.showToast({
					image:'../../static/images/fail.png',
					title: '网络请求失败',
					duration: 2000
				});
				reject(err)
			}
		})
	})
}

export function post(url, params) {
	uni.showLoading()
	return new Promise((resolve, reject) => {
		uni.request({
			url: url,
			method: 'POST',
			data: JSON.stringify(params),
			success: res => {
				uni.hideLoading()
				resolve(res.data)
			},
			fail: err => {
				uni.hideLoading()
				uni.showToast({
					image:'../../static/images/fail.png',
					title: '网络请求失败',
					duration: 2000
				});
				reject(err)
			}
		})
	})
}
